package com.xlz.day40encryptiondemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;

public class Base64Activity extends AppCompatActivity {

    private String data="望长城内外惟余莽莽";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base64);

        byte[] encode = Base64.encode(data.getBytes(), Base64.DEFAULT);
        Log.d("flag", "------------------>onCreate: 使用 Base64编码的内容：" +new String(encode));

        String str="";
        byte[] decode = Base64.decode(encode, Base64.DEFAULT);
        Log.d("flag", "------------------>onCreate: 使用Base64解码的数据是：" +new String(decode));

    }
}
